feat: Add nested hypergraph generators (Kim et al. 2023, Barrett et al. 2025)#683
feat: Add nested hypergraph generators (Kim et al. 2023, Barrett et al. 2025)#683jg-you wants to merge 6 commits intoxgi-org:devfrom
Conversation
|
Thanks @jg-you ! Quick dispatching for a few points:
I can review |
|
The failing test ( Merging |
|
Fixed, should be g2g |
|
|
||
| # Step 1: Generate m unique facets of size d | ||
| facets = set() | ||
| while len(facets) < m: |
There was a problem hiding this comment.
This may go into an infinite loop if m is large and d large compared to N right?
If so, add some checks earlier on and throw an error to prevent this
There was a problem hiding this comment.
That's fair! Actual condition is m > (n choose d).
How much optimization is worth it to the library?
I could implement sampling non-edges if m > (n choose d) // 2, which would give good performance to this algorithm in the sparse and dense regimes. Maybe there's another quick win for m \approx (n choose d) // 2.
|
Ok I reviewed |
Ty, all implemented except for the one comment I have a question about -- level of optimization desired. |
Adds two generative models that explicitly parameterize nestedness:
random_nested_hypergraphandsimplicial_chung_lu_hypergraph.Barrett et al.: Implementation of Algorithms 3 and 4 from the paper. Couldn't find much to re-use between this and
chung_lu_hypergraphsince the methods are fundamentally different.Kim et al.: Implements the algorithm described in Section II here. Duplicate edges are prevented during facet generation (step 1) and after rewiring (step 3) using frozenset sets. I wasn't sure whether
epsilonwas fixed or could vary by order, so I made this argument a list or a float to support both cases.Notes
dfor edge size,pfor probability,epsilonfor retention,k1/k2for degree/size sequences.